/*
AlliedBridge Content Management System
Copyright (C) 2006 AlliedBridge

This program is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software Foundation;

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.volume4.spring;

import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.Date;
import java.util.Map;
import java.util.HashMap;

import org.volume4.alliedbridge.model.person.MemberBean;
import org.volume4.alliedbridge.model.person.MemberManagerBean;

public class AlliedBridgeController implements Controller {	

    private MemberManagerBean mmbean;

    public MemberManagerBean getMemberManagerBean() {
        return mmbean;
    }

    public void setMemberManagerBean(MemberManagerBean mmbean) {
        this.mmbean = mmbean;
    }

    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        String now = (new Date()).toString();

        Map memberModel = new HashMap();
        memberModel.put("now", now);
        memberModel.put("members", getMemberManagerBean().getMembers());

        return new ModelAndView("model_view", "member_model", memberModel);

    }
}